/*
 * $Id: Actions.java 24 2009-03-31 23:40:10Z aaron.day $
 */

package org.crazydays.gameplan;


import java.util.HashMap;

import javax.swing.Action;

import org.crazydays.gameplan.data.OpenAction;
import org.crazydays.gameplan.data.SaveAction;
import org.crazydays.gameplan.data.SaveAsAction;
import org.crazydays.gameplan.map.swing.event.GridToggleAction;
import org.crazydays.gameplan.map.swing.event.OpenCreateMapAction;
import org.crazydays.gameplan.swing.AboutAction;

/**
 * Actions
 */
public class Actions
        extends HashMap<String, Action>
{
	/** serial version uid */
	public final static long serialVersionUID =
	        "$Id: Actions.java 24 2009-03-31 23:40:10Z aaron.day $"
	                .hashCode();

	/** action: open database */
	public final static String OPEN_DATABASE = "OpenDatabase";

	/** action: save */
	public final static String SAVE = "Save";

	/** action: save as */
	public final static String SAVE_AS = "SaveAs";

	/** action: open create map */
	public final static String OPEN_CREATE_MAP = "OpenCreateMap";

	/** action: grid toggle */
	public final static String GRID_TOGGLE = "GridToggle";

	/** action: about */
	public final static String ABOUT = "About";

	/** game plan */
	protected GamePlan gamePlan;

	/**
	 * Actions constructor.
	 * 
	 * @param gamePlan GamePlan
	 */
	public Actions(GamePlan gamePlan)
	{
		setGamePlan(gamePlan);
		initialize();
	}

	/**
	 * Initialize actions.
	 */
	protected void initialize()
	{
		// file menu actions
		put(OPEN_DATABASE, new OpenAction(getGamePlan()));
		put(SAVE, new SaveAction(getGamePlan()));
		put(SAVE_AS, new SaveAsAction(getGamePlan()));
		put(OPEN_CREATE_MAP, new OpenCreateMapAction(getGamePlan()));

		// view menu actiosn
		put(GRID_TOGGLE, new GridToggleAction(getGamePlan()));

		// help menu actions
		put(ABOUT, new AboutAction(getGamePlan()));

	}

	/**
	 * Set game plan.
	 * 
	 * @param gamePlan GamePlan
	 */
	public void setGamePlan(GamePlan gamePlan)
	{
		this.gamePlan = gamePlan;
	}

	/**
	 * Get game plan.
	 * 
	 * @return GamePlan
	 */
	public GamePlan getGamePlan()
	{
		return gamePlan;
	}
}
